<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <!-- <ul>
        <li>
            <a href="">
                <img src="" alt="">
                <h3></h3>
                <p></p>
                <strong></strong>
            </a>
        </li>
    </ul> -->



    <script>

        const xhr = new XMLHttpRequest();

        xhr.open('get', '../data/goods.json', true);

        xhr.send();

        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4 && xhr.status === 200) {
                let data = xhr.responseText;
                console.log(data);
                data = JSON.parse(data) ;
                console.log(data);


                let html = '' ;
                // data.forEach( v => {
                //     const {goodsSrc , goodsPrice , goodsName , goodsDes} = v ;
                // })

                data.forEach( ({goodsSrc , goodsPrice , goodsName , goodsDes}) => {
                    html += `
                        <li>
                            <a href="">
                                <img src="${goodsSrc}" alt="">
                                <h3>${goodsName}</h3>
                                <p>${goodsDes}</p>
                                <strong>${goodsPrice}</strong>
                            </a>
                        </li>
                    `
                })

                console.log(html);

            }
        }

    </script>
</body>

</html>